﻿using SuporeSliplampApp.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SuporeSliplampApp.Views
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            InitializeComponent();
            var model = LoginViewModel.GetInstance();
            this.DataContext = model;
        }

        private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        private void editPortBtn_Click(object sender, RoutedEventArgs e)
        {
            //double[]d = new double[2];
            //d[0] = this.Top+this.Height/2;
            //d[1] = this.Left+this.Width/2;
            EditPortWindow editPortWindow = new EditPortWindow();
            editPortWindow.action += this.GetSeverInfo;
            editPortWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            editPortWindow.ShowDialog();
        }

        public void GetSeverInfo(string serverInfo)
        {
            //this.IPTxt.Text = serverInfo;
        }


        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                this.DragMove();
            }
        }


        //private void Btn_MinSize_Click(object sender, RoutedEventArgs e)
        //{
        //    this.WindowState = WindowState.Minimized;
        //}

        //private void Btn_Close_Click(object sender, RoutedEventArgs e)
        //{
        //    this.Close();
        //}
    }
}
